package com.briup.cms.service.impl;
import com.briup.cms.bean.BaseLog;
import com.briup.cms.dao.BaseLogMapper;
import com.briup.cms.dao.extend.BaseLogExtendMapper;
import com.briup.cms.exception.CustomerException;
import com.briup.cms.service.IBaseLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BaseLogServiceImpl implements IBaseLogService{

    @Autowired
    private BaseLogMapper baseLogMapper;

    @Autowired
    private BaseLogExtendMapper mapper;

    @Override
    public PageInfo<BaseLog> pageQuery(int pageNum, int pageSize) throws CustomerException {

        PageHelper.startPage(pageNum,pageSize);
        System.out.println(pageNum+"和"+pageSize);
        List<BaseLog> list = mapper.findAllBaseLogByPage();
        System.out.println(list);
        PageInfo<BaseLog> pageInfo = new PageInfo<BaseLog>(list);
        System.out.println(pageInfo);
        return pageInfo;
    }


    @Override
    public void AddLogInfo(BaseLog baseLog) {
        baseLogMapper.insert(baseLog);
    }

    @Override
    public void deleteByPrimaryKey(Long logId) {
        baseLogMapper.deleteByPrimaryKey(logId);
    }

    @Override
    public BaseLog selectByPrimaryKey(Long logId) {
        BaseLog baseLog=baseLogMapper.selectByPrimaryKey(logId);
        return baseLog;
    }

    @Override
    public void updateByPrimaryKey(BaseLog record) {
        baseLogMapper.updateByPrimaryKey(record);
    }

}

